home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / bbs_util / nef234.zip / FEATURE / FEATURE.C next >
C/C++ Source or Header  |  1996-01-14  |  3KB  |  82 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*                 (C) Copyright 1991-1996  Alberto Pasquale                 */
  4. /*                                                                           */
  5. /*                   A L L   R I G H T S   R E S E R V E D                   */
  6. /*                                                                           */
  7. /*****************************************************************************/
  8. /*                                                                           */
  9. /*   How to contact the author:  Alberto Pasquale of 2:332/504@fidonet       */
  10. /*                               alberto.pasquale@mo.nettuno.it              */
  11. /*                               Viale Verdi 106                             */
  12. /*                               41100 Modena                                */
  13. /*                               Italy                                       */
  14. /*                                                                           */
  15. /*****************************************************************************/
  16.  
  17. // Feature.Cpp
  18.  
  19. // This is a sample source for a NEF Feature DLL.
  20. // It only writes to the screen the full filename, tag and desc of
  21. // tossed files.
  22. // A prefix can be specified with the "OutPrefix" cfg statement; example:
  23. // OutPrefix "New File: "
  24.  
  25.  
  26. #include <string.h>
  27. #include <stdio.h>
  28. #include "NeFeat.H"
  29.  
  30.  
  31. static FeatOut pf;        // function for output to screen and log
  32. static char outpref[100];
  33.  
  34.  
  35. APIRET APIENTRY _export Init (FeatOut prnf)
  36. {
  37.     pf = prnf;
  38.                         // default output prefix
  39.     strcpy (outpref, "New File: ");
  40.     return NFI_OK;
  41. }
  42.  
  43.  
  44. APIRET APIENTRY _export ParseCfg (PCSZ clnline)
  45. {
  46.    char *p;
  47.    int len;
  48.  
  49.     if (strnicmp (clnline, "OutPrefix ", 10) == 0) {
  50.         p = clnline;
  51.         p += 10;                // skip the keyword
  52.         p += strspn (p, " ");   // skip space
  53.         if (*p != '\"')
  54.             return NFP_ERR;
  55.         p ++;                   // skip opening quotes
  56.         len = strlen (p);
  57.         if (len == 0)
  58.             return NFP_ERR;
  59.         if (*(p+len-1) != '"')   // check closing quotes
  60.             return NFP_ERR;
  61.         len --;
  62.         strncpy (outpref, p, len);    // store format string in static data
  63.         outpref[len] = '\0';
  64.         return NFP_OK;
  65.     }
  66.     return NFP_ERR;
  67. }
  68.  
  69.  
  70. APIRET APIENTRY _export BeforeNefToss (PCSZ fullname, PCSZ Tag, PCSZ Desc)
  71. {
  72.     pf (FO_BOTH, '*', "%s%s %s\n", outpref, fullname, Tag);
  73.     return BNT_OK;
  74. }
  75.  
  76.  
  77. APIRET APIENTRY _export AfterNefToss (_TICDATA *td)
  78. {
  79.     pf (FO_BOTH, ' ', "%s\n", td->desc);
  80.     return ANT_OK;
  81. }
  82.